package lc.smart.android.main;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

@SuppressWarnings("deprecation")
public class MainActivity extends Activity
{
	//	SlidingMenuView slidingMenuView;
	//	ViewGroup tabcontent;

	public static final String TAG_STRING = "MainActivity";//标识
	private Context mContext;
	private ListView activityTitleListView;
	private String[] activityTitleStrings;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mContext = this;

		//showDefaultTab();
		//进行列表控件初始化
		this.activityTitleListView = (ListView) findViewById(R.id.lv_main_activity_title);
		activityTitleStrings = getResources().getStringArray(
				R.array.activity_titles);
		ArrayAdapter<String> listViewAdapter = new ArrayAdapter<String>(
				getApplicationContext(), android.R.layout.simple_list_item_1,
				activityTitleStrings);
		this.activityTitleListView.setAdapter(listViewAdapter);
		//注册点击子项监听事件
		this.activityTitleListView
				.setOnItemClickListener(activityTitleItemClick);

	}

	private OnItemClickListener activityTitleItemClick = new OnItemClickListener()
	{
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3)
		{
			// TODO Auto-generated method stub
			if ("CameraIntent".equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext, CameraIntent.class);
				startActivity(intent);
			}
			else if ("MediaStoreCameraActivity"
					.equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext,
						MediaStoreCameraActivity.class);
				startActivity(intent);
			}
			else if ("MediaStoreGalleryActivity"
					.equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext,
						MediaStoreGalleryActivity.class);
				startActivity(intent);
			}
			else if ("WebViewActivity".equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext, WebViewActivity.class);
				startActivity(intent);
			}
			else if ("MyCameraSimpleActivity"
					.equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext,
						MyCameraSimpleActivity.class);
				startActivity(intent);
			}
			else if ("CameraTimerSnapActivity"
					.equals(activityTitleStrings[arg2]))
			{
				Intent intent = new Intent(mContext,
						CameraTimerSnapActivity.class);
				startActivity(intent);
			}
			else if (6 == arg2)
			{
				Intent intent = new Intent(mContext, MyActionBarActivity.class);
				startActivity(intent);
			}
			else
			{
				Log.i(TAG_STRING, "activityTitleItemClick ---error!!!!");
			}

		}
	};

	//	void showDefaultTab()
	//	{
	//		Intent i = new Intent(this, HomeActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				HomeActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//	}
	//
	//	public void hideMenu(View view)
	//	{
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void showMenu(View view)
	//	{
	//		slidingMenuView.scrollLeft();
	//	}
	//
	//	public void login(View view)
	//	{
	//		Intent i = new Intent(this, LoginActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				LoginActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void first(View view)
	//	{
	//		showDefaultTab();
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void gotoMyProducts(View view)
	//	{
	//		Intent i = new Intent(this, MyProductsActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				MyProductsActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void gotoMyOrders(View view)
	//	{
	//		Intent i = new Intent(this, MyOrdersActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				MyOrdersActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void gotoConactUs(View view)
	//	{
	//		Intent i = new Intent(this, ContaceUsActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				ContaceUsActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//		slidingMenuView.scrollRight();
	//	}
	//
	//	public void gotoAboutUs(View view)
	//	{
	//		Intent i = new Intent(this, AboutUsActivity.class);
	//		View v = getLocalActivityManager().startActivity(
	//				AboutUsActivity.class.getName(), i).getDecorView();
	//		tabcontent.removeAllViews();
	//		//tabcontent.addView(vHeader);
	//		tabcontent.addView(v);
	//		slidingMenuView.scrollRight();
	//	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{
		// Inflate the menu; this adds items to the action bar if it is present.
		//getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
